#ifndef DYNAMIC_ENTITY_H
#define DYNAMIC_ENTITY_H
#include "Def.h"
#include "GeoEntity.h"
#include "Property.h"

class HistoryTrackPoint : public GeoEntity
{
public:
	virtual void setColor(const QString& color) = 0;
	virtual QString getColor()const = 0;

	virtual HistoryTrackLine* getTrackLine() const = 0;
};

class HistoryTrackLine
{
public:
	virtual QString getId() = 0;

	virtual QString getColor()const = 0;
	virtual void setColor(const QString& color) = 0;

	virtual double getLineWidth() const = 0;
	virtual void setLineWidth(double width) = 0;
public:
	virtual quint32 getPointNum() = 0;
	virtual HistoryTrackPoint* getTrackPointByIndex(quint32 index) = 0;
	virtual HistoryTrackPoint* createTrackPoint(double lon,double lat,double alt) = 0;

	virtual void appendTrackPoint(HistoryTrackPoint* point) = 0;
	virtual void insertTrackPoint(HistoryTrackPoint* point,quint32 index) = 0;
	virtual void removeTrackPointByIndex(quint32 index) = 0;
	virtual void removeAllPoints() = 0;

	virtual bool isEmpty() = 0;

	virtual bool getPointVisible() const = 0;
	virtual void setPointVisible(bool b) = 0;
	virtual int  getPointSize() const = 0;
	virtual void setPointSize(int sz) = 0;
};

class HistoryTrackSet
{
public:
	virtual HistoryTrackLine* createTrackLine(int lineWidth,const QString& color) = 0;
	virtual bool addTrackLine(HistoryTrackLine* line) = 0;

	virtual bool removeTrackLine(HistoryTrackLine* line) = 0;
	virtual void removeAll() = 0;

	virtual bool containsTrackLine(HistoryTrackLine* line) = 0;
	virtual QList<HistoryTrackLine*> getAllTrackLines() = 0;

	virtual HistoryTrackPoint* pickPoint(int x,int y) = 0;
};

class DynTargetItem : public GeoEntity
{
public:
	virtual DynTargetItemTrack* track() const = 0;

	virtual bool isAirplane() const = 0;
	virtual bool isShip() const = 0;

	virtual QString getNation() const = 0;
	virtual QString getGroupName() const = 0;
	virtual QString getItemType()const = 0;

	virtual bool appendTrack(double lon,double lat,double alt,quint64 time,double head = 0.0) = 0;

	virtual void setColor(const QString& color) = 0;
	virtual void setTrackColor(const QString& color) = 0;

	virtual bool isContains(double lon,double lat) = 0;

	virtual DynTargetItemSet* getDynTargetSet() const = 0;
	virtual HistoryTrackLine* getHistoryTrackLine()const = 0;
};

class DynTargetItemSet
{
public:
	virtual bool addDynTargetItem(DynTargetItem* item) = 0;

	virtual DynTargetItem* createDynTargetItem(const QString& group,const QString& name,const QString& nation,const QString& target) = 0;

	virtual DynTargetItem* getDynTargetItemByName(const QString& name) const = 0;
	virtual DynTargetItem* getDynTargetItem(const QString& id) const = 0;
	virtual QList<DynTargetItem*> getDynTargetListByGroup(const QString& group) = 0;
	
	virtual DynTargetItem* getDynTargetItemByIndex(int index) = 0;
	virtual int getDynTargetCount() const = 0;

	virtual bool removeDynTargetItem(DynTargetItem* item) = 0;
	virtual void clearTargets() = 0;

	virtual QList<DynTargetItem*> isDynTargetItemEx(int x,int y) = 0;

	virtual DynTargetItem* isTrackPoint(int x,int y,int* index = nullptr) = 0;
public:
	virtual void setGroupVisible(const QString& group,bool visible) = 0;
	virtual bool getGroupVisible(const QString& group) = 0;
	virtual bool removeGroup(const QString& group) = 0;
	virtual QStringList getAllGroups() = 0;
};

class DynTargetManager
{
public:
	virtual bool initialize(const QString& config = "..\\situation\\config.xml") = 0;

	virtual DynTargetItemSet* createDynTargetItemSet(const QString& name = "dyntarget") = 0;
	virtual bool containsDynTargetItemSet(const QString& name) = 0;
	virtual QStringList getDynTargetItemSetList()const = 0;

	virtual bool removeTargetItemSet(DynTargetItemSet* set) = 0;

	//virtual bool defineDynamicTargetType(int code,const QString& nation,const QString& description,const QString& iconFile) = 0;
};

#endif